#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "aut.h" 


void on_Directeur_clicked (GtkWidget *objet_graphique,gpointer user_data)
{
GtkWidget *head_secu;
GtkWidget *log_mdp;

head_secu=lookup_widget(objet_graphique, "head_secu");
gtk_widget_hide(head_secu);

log_mdp = create_log_mdp ();
gtk_widget_show (log_mdp);


}


void on_security_clicked (GtkWidget *objet_graphique,gpointer user_data)
{
GtkWidget *head_secu;
GtkWidget *log_mdp2;

head_secu=lookup_widget(objet_graphique, "head_secu");
gtk_widget_hide(head_secu);

log_mdp2 = create_log_mdp2 ();
gtk_widget_show (log_mdp2);
}


void on_quit1_clicked (GtkWidget *objet_graphique,gpointer user_data)
{gtk_main_quit();
}


void on_ok1_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];
int test;
char chemin[] = "/home/hedi/Projects/project1/src/info_head.txt";
GtkWidget *login1;//saisie graphique du login
GtkWidget *mdp1;//saisie graphique du prenom

login1 = lookup_widget(objet_graphique, "login1");
mdp1 = lookup_widget(objet_graphique, "mdp1");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(login1)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(mdp1)));
test=verif_fheadmaster1(chemin,log,mdp);
if (test==1)
{
GtkWidget *log_mdp;
GtkWidget *pat_perso;

log_mdp=lookup_widget(objet_graphique, "log_mdp");
gtk_widget_hide(log_mdp);

pat_perso = create_pat_perso ();
gtk_widget_show (pat_perso);
}
else gtk_main_quit();


}


void
on_patient_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_personnel_clicked                   (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_modif_head_clicked(GtkWidget *objet_graphique,gpointer user_data)
{
GtkWidget *pat_perso;
GtkWidget *modifh;

pat_perso=lookup_widget(objet_graphique, "pat_perso");
gtk_widget_hide(pat_perso);

modifh = create_modifh ();
gtk_widget_show (modifh);
}


void on_quit3_clicked  (GtkWidget *objet_graphique,gpointer user_data)
{

GtkWidget *pat_perso;
GtkWidget *head_secu;

pat_perso=lookup_widget(objet_graphique, "pat_perso");
gtk_widget_hide(pat_perso);

head_secu = create_head_secu ();
gtk_widget_show (head_secu);

}


void
on_parcours_clicked                    (GtkButton       *button,
                                        gpointer         user_data)
{

}


void
on_capteur_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{

}


void on_modif2_clicked (GtkWidget *objet_graphique,gpointer user_data)
{

GtkWidget *par_capt;
GtkWidget *modifs;

par_capt=lookup_widget(objet_graphique, "par_capt");
gtk_widget_hide(par_capt);

modifs = create_modifs ();
gtk_widget_show (modifs);

}


void on_quit4_clicked (GtkWidget *objet_graphique,gpointer user_data)
{
GtkWidget *par_capt;
GtkWidget *head_secu;

par_capt=lookup_widget(objet_graphique, "par_capt");
gtk_widget_hide(par_capt);

head_secu = create_head_secu ();
gtk_widget_show (head_secu);
}


void on_ok2_clicked (GtkWidget *objet_graphique,gpointer user_data)
{char log[31],mdp[31];
int test;
char chemin[] = "/home/hedi/Projects/project1/src/info_security.txt";
GtkWidget *login2;//saisie graphique du login
GtkWidget *mdp2;//saisie graphique du prenom

login2 = lookup_widget(objet_graphique, "login2");
mdp2 = lookup_widget(objet_graphique, "mdp2");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(login2)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(mdp2)));
test=verif_fheadmaster1(chemin,log,mdp);
if (test==1)
{
GtkWidget *log_mdp2;
GtkWidget *par_capt;

log_mdp2=lookup_widget(objet_graphique, "log_mdp2");
gtk_widget_hide(log_mdp2);

par_capt = create_par_capt ();
gtk_widget_show (par_capt);
}
else gtk_main_quit();


}


void on_ok3_clicked  (GtkWidget *objet_graphique,gpointer user_data)
{
char log[100],mdp[100];
int test;
char chemin[] = "/home/hedi/Projects/project1/src/info_head.txt";
GtkWidget *new_log0;//saisie graphique du login
GtkWidget *new_mdp0;//saisie graphique du prenom

new_log0 = lookup_widget(objet_graphique, "new_log0");
new_mdp0 = lookup_widget(objet_graphique, "new_mdp0");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(new_log0)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(new_mdp0)));
modif_fsecurity0(chemin,log,mdp);

GtkWidget *modifh;
GtkWidget *pat_perso;

modifh=lookup_widget(objet_graphique, "modifh");
gtk_widget_hide(modifh);

pat_perso = create_pat_perso ();
gtk_widget_show (pat_perso);

}



void on_ok4_clicked   (GtkWidget *objet_graphique,gpointer user_data)
{
char log[100],mdp[100];
int test;
char chemin[] = "/home/hedi/Projects/project1/src/info_security.txt";
GtkWidget *new_log1;//saisie graphique du login
GtkWidget *new_mdp1;//saisie graphique du prenom

new_log1 = lookup_widget(objet_graphique, "new_log1");
new_mdp1 = lookup_widget(objet_graphique, "new_mdp1");
//copie de login1 vers log
strcpy(log,gtk_entry_get_text(GTK_ENTRY(new_log1)));
///copie de mdp1 vers mdp
strcpy(mdp,gtk_entry_get_text(GTK_ENTRY(new_mdp1)));
modif_fsecurity0(chemin,log,mdp);

GtkWidget *modifs;
GtkWidget *par_capt;

modifs=lookup_widget(objet_graphique, "modifs");
gtk_widget_hide(modifs);

par_capt = create_par_capt ();
gtk_widget_show (par_capt);

}








